#!/bin/bash

echo "=== 测试RocketMQ API ==="

# 等待应用启动
echo "等待应用启动..."
sleep 5

# 测试健康检查
echo "1. 测试健康检查..."
curl -s http://localhost:8080/api/rocketmq/health | jq .

# 测试发送消息
echo "2. 测试发送消息..."
curl -s -X POST http://localhost:8080/api/rocketmq/send \
  -H "Content-Type: application/json" \
  -d '{"content": "测试消息 - $(date)", "priority": "HIGH"}' | jq .

# 测试批量发送
echo "3. 测试批量发送消息..."
curl -s -X POST http://localhost:8080/api/rocketmq/send-batch \
  -H "Content-Type: application/json" \
  -d '{"count": 50}' | jq .

# 等待消息处理
echo "等待消息处理..."
sleep 10

# 查看统计信息
echo "4. 查看消息统计..."
curl -s http://localhost:8080/api/rocketmq/stats | jq .

echo "=== 测试完成 ==="

